<?php
	class string_function 
	{
		function isEmail($text) {
			if(preg_match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$^', $text))
				return true;
			else
				return false;
		}
		function provide_password($str) {
			$str_hash = substr(hash('sha256', $str), 5, 15);
			return md5($str_hash);		
		}
		function random_password(){
			$length = 10;
			$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
    		return substr(str_shuffle($chars), 0, $length);
		}
		function validate_username($username) {
		    return preg_match('/^[A-Za-z0-9]{5,12}$/', $username);
		}
	}
?>